package cn.powertime.evaluation.shiro.cacho;

import org.apache.shiro.cache.Cache;
import org.apache.shiro.cache.CacheException;
import org.apache.shiro.cache.CacheManager;
import org.springframework.data.redis.core.RedisTemplate;

/**
 * @author ZYW
 */
public class RedisCacheManager implements CacheManager {

    private RedisTemplate<String, Object> redisCacheTemplate;

    public RedisCacheManager(RedisTemplate<String, Object> redisCacheTemplate){
        this.redisCacheTemplate = redisCacheTemplate;
    }

    @Override
    public <K, V> Cache<K, V> getCache(String name) throws CacheException {
        return new RedisCache<>(name,redisCacheTemplate);
    }
}
